Replace malloc with alloc in hot paths for improved performance.
Signed-off-by: Santosh Jodh <santosh.jodh@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
* IOCTL_PRIVCMD_MMAPBATCH.
*/
- xen_pfn_t *pfn = malloc(num * sizeof(*pfn));
+ xen_pfn_t *pfn = alloca(num * sizeof(*pfn));
if ( pfn )
{
break;
}
- free(pfn);
-
if ( rc == -ENOENT && i == num )
rc = 0;
else if ( rc )
if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
domids_stride = 0;
- map = malloc(sizeof(*map) +
+ map = alloca(sizeof(*map) +
(count - 1) * sizeof(struct ioctl_gntdev_map_grant_ref));
if ( map == NULL )
return NULL;
}
out:
- free(map);
return addr;
}